package com.situ.day13;

import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Wangge {
	public static void main(String[] args) {
		JFrame jf = new JFrame();  //新建
		jf.setTitle("测试");		  //窗口名
		jf.setSize(300, 200);	//窗口
		jf.setLocation(300, 300);//位置从左上开始
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认退出操作
		jf.setVisible(true);//把窗口显示在屏幕上
		jf.setResizable(false);//固定窗口大小，禁止拖拽
		
		JPanel Panel = new JPanel();//创建容器布局
		jf.add(Panel);//容器添加到窗口
		Panel.setLayout(new GridLayout(3, 1));//设置边界布局
		//组件
		JPanel namePanel = new JPanel();
		JLabel nameLabel = new JLabel("用户名");
		JTextField nameTextFiles = new JTextField(10);
		namePanel.add(nameLabel);
		namePanel.add(nameTextFiles);
		Panel.add(namePanel);
		//密码
		JPanel passwordPanel = new JPanel();
		JLabel passwordLabel = new JLabel("密码");
		JTextField passwordTextFiles = new JTextField(11);
		passwordPanel.add(passwordLabel);
		passwordPanel.add(passwordTextFiles);
		Panel.add(passwordPanel);
		//按钮
		JPanel loginPanel = new JPanel();
		JButton loginButton = new JButton("登陆");
		JButton canceButton = new JButton("取消");
		loginPanel.add(loginButton);
		loginPanel.add(canceButton);
		Panel.add(loginPanel);
		
		jf.setContentPane(Panel);//面板容器作为内容面板设置到窗口
		
		
	}
}
